package com.diandian.backend.store.controller;

import com.diandian.backend.store.service.StoreKuaishouLifeStoreInfoService;
import com.diandian.base.boot.starter.response.BaseResult;
import com.diandian.backend.store.param.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * [门店]快手本地生活门店信息表
 *
 * @author zyz diandian@qq.com
 * @since 1.0.0 2025-09-10
 */
@RestController
@RequestMapping("/kuaishou/life/store/info")
public class KuaishouLifeStoreInfoController{

    @Autowired
    private StoreKuaishouLifeStoreInfoService iStoreKuaishouLifeStoreInfoService;

    @PostMapping("/page")
    public BaseResult page(@RequestBody StoreKuaishouLifeStoreInfoPageParam param) {
//        param.check();
        return new BaseResult(0, "success",iStoreKuaishouLifeStoreInfoService.page(param.toDTO()));
    }

    @PostMapping("/detail")
    public BaseResult getDetail(@RequestBody StoreKuaishouLifeStoreInfoDetailParam param) {
        param.check();
        return new BaseResult(0, "success",iStoreKuaishouLifeStoreInfoService.getDetail(param.toDTO()));
    }

    /**
     * 根据线上门店编码或线下门店编码查询门店信息
     */
    @PostMapping("/detail/code")
    public BaseResult getDetailByCode(@RequestBody StoreKuaishouLifeStoreInfoDetailByCodeParam param) {
        param.check();
        return new BaseResult(0, "success",iStoreKuaishouLifeStoreInfoService.getDetail(param.toDTO()));
    }

    @PostMapping("/updateById")
    public BaseResult updateById(@RequestBody StoreKuaishouLifeStoreInfoUpdateByIdParam param) {
        param.check();
        iStoreKuaishouLifeStoreInfoService.updateById(param.toDTO());
        return new BaseResult(0, "success", null);
    }

    @PostMapping("/deleteById")
    public BaseResult deleteById(@RequestBody StoreKuaishouLifeStoreInfoDeleteByIdParam param) {
        param.check();
        iStoreKuaishouLifeStoreInfoService.deleteById(param.toDTO());
        return new BaseResult(0, "success", null);
    }

    @PostMapping("/add")
    public BaseResult add(@RequestBody StoreKuaishouLifeStoreInfoAddParam param) {
        param.check();
        iStoreKuaishouLifeStoreInfoService.add(param.toDTO());
        return new BaseResult(0, "success", null);
    }

    @PostMapping("/list")
    public BaseResult list(@RequestBody StoreKuaishouLifeStoreInfoListParam param) {
        param.check();
        return new BaseResult(0, "success",iStoreKuaishouLifeStoreInfoService.getList(param.toDTO()));
    }

}